package cn.kust.chat.utils;

import io.netty.channel.Channel;


import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * 用户id和channel的关联关系处理
 */
public class UserChannelRel {
    // 必须采用线程安全
    private final static Map<Long, Channel> manage = new ConcurrentHashMap<>();


    public static void put(Long userId, Channel channel) {
        manage.put(userId, channel);
    }

    public static Channel getChannel(Long userId) {
        return manage.get(userId);
    }

    public static void remove(Long userId) {
        manage.remove(userId);
    }
}
